local tongge = fk.CreateSkill {
  name = "inker_tongge",
  max_turn_use_time = 1,
}

tongge:addEffect(fk.Damage, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(tongge.name) and data.card and data.card.number > 0 and data.by_user
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local number = data.card.number
    local _, dat = room:askToUseActiveSkill(player, {
      skill_name = "#inker_tongge_active",
      prompt = "#inker_tongge-invoke:" .. target.id .. "::" .. number,
      extra_data = {
        skillName = tongge.name,
        number = number,
        tos = { target },
      }
    })
    if dat then
      event:setCostData(self, { number = number, cards = dat.cards, tos = dat.targets })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local dat = event:getCostData(self)
    local card = dat.cards
    room:throwCard(card, tongge.name, player, player)
    if not target.dead then
      local draw_num = 4 - target:getHandcardNum()
      if draw_num > 0 then
        target:drawCards(draw_num, tongge.name)
      end
    end
  end
}, { check_skill_limit = true })

Fk:loadTranslationTable{
  ["inker_tongge"] = "同戈",
  [":inker_tongge"] = "每回合限一次，有角色使用牌造成伤害后，你可弃置任意张点数为此牌倍数的牌，令其将手牌补至四张。",

  ["#inker_tongge-invoke"] = "同戈：你可以弃置任意张点数和（当前为0/%arg）为 %arg 倍数的牌，令 %src 将手牌补至四张。",

  ["$inker_tongge1"] = "北威襄樊、南镇江东，父子在，何惧西风！",
  ["$inker_tongge2"] = "虎贲曳春风，健儿擎青帜，一夕，可绿江南！",
}

return tongge